//
//  CSGXMasterCell.m
//  CarSalesMS_GCX
//
//  Created by Ssky on 2016/12/20.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CSGXMasterCell.h"

@interface CSGXMasterCell ()

@property (nonatomic, weak) UILabel *lblIndex;
@property (nonatomic, weak) UILabel *lblName;
@property (nonatomic, weak) UILabel *lblType;
@property (nonatomic, weak) UILabel *lblHousewareName;
@property (nonatomic, strong) NSArray<UILabel *> *commTypeLabels;



@end

@implementation CSGXMasterCell


#pragma mark - methods
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:NO animated:animated];
}

- (void)distribute {
    
    
    
}









#pragma mark - setupUI
- (void)setupUI {
//    UIView *vLine = [[UIView alloc] init];
//    [self.contentView addSubview:vLine];
//    
//    vLine.backgroundColor = [UIColor gx_colorWithRed:232 green:232 blue:232];
//    [vLine mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.leading.bottom.trailing.equalTo(self.contentView).mas_offset(0);
//        make.height.mas_offset(0.8);
//    }];

    
    //lblIndex
    UILabel *lblIndex = [UILabel gx_labelWithText:@"2" fontSize:13 color:[UIColor whiteColor]];
    [self.contentView addSubview:lblIndex];
    self.lblIndex = lblIndex;
    
    lblIndex.backgroundColor = [UIColor orangeColor];
    lblIndex.textAlignment = NSTextAlignmentCenter;
    
    [lblIndex mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(2);
        make.leading.equalTo(self.contentView).mas_offset(4);
        make.width.mas_offset(20);
    }];
    
    //lblName
    UILabel *lblName = [UILabel gx_labelWithText:@"大今野葱香排骨面" fontSize:13 color:[UIColor blackColor]];
    [self.contentView addSubview:lblName];
    self.lblName = lblName;
    
    [lblName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lblIndex).mas_offset(0);
        make.leading.equalTo(lblIndex.mas_trailing).mas_offset(2);
    }];
    
    //lblType
    UILabel *lblType = [UILabel gx_labelWithText:@"1 * 26" fontSize:12 color:[UIColor grayColor]];
    [self.contentView addSubview:lblType];
    self.lblType = lblType;
    
    [lblType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lblName.mas_bottom).mas_offset(3);
        make.leading.equalTo(lblIndex).mas_offset(0);
    }];
    
    //lblHousewareName
    UILabel *lblHousewareName = [UILabel gx_labelWithText:@"主仓库" fontSize:13 color:[UIColor blackColor]];
    [self.contentView addSubview:lblHousewareName];
    self.lblHousewareName = lblHousewareName;
    
    [lblHousewareName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(self.contentView).mas_offset(-5);
        make.centerY.equalTo(self.contentView).mas_offset(0);
    }];

    //lables
    NSMutableArray<UILabel *> *mLables = [NSMutableArray<UILabel *> array];
    for (int i = 0; i < 3; i++) {
        UILabel *label = [UILabel gx_labelWithText:@"aaa" fontSize:13 color:[UIColor blackColor]];
        [self.contentView addSubview:label];
        
        [mLables addObject:label];
    }
    self.commTypeLabels = mLables;
    
    [self.commTypeLabels[0] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lblIndex).mas_offset(0);
        make.centerX.equalTo(self);
        make.size.mas_offset(CGSizeMake(60, 22));
    }];
    
    [self.commTypeLabels[1] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.commTypeLabels[0].mas_bottom).mas_offset(2);
        make.size.centerX.mas_equalTo(self.commTypeLabels[0]);
    }];
    
    [self.commTypeLabels[2] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.commTypeLabels[1].mas_bottom).mas_offset(2);
        make.size.centerX.mas_equalTo(self.commTypeLabels[0]);
        make.bottom.equalTo(self.contentView).mas_offset(-2);
    }];
    

}





#pragma mark - setter & getter
- (void)setInventoryMasterList:(NSArray *)inventoryMasterList {
    _inventoryMasterList = inventoryMasterList;
    
    [self distribute];
}




@end
